]> git.neil.brown.name Git - wiggle.git/commitdiff
Don't allow patch reviewing and patch applying to overlap
authorNeil Brown <neilb@suse.de>
Tue, 13 Jun 2006 12:57:00 +0000 (22:57 +1000)
committerNeil Brown <neilb@suse.de>
Tue, 13 Jun 2006 12:57:00 +0000 (22:57 +1000)
Otherwise we get into a mess

Signed-off-by: Neil Brown <neilb@suse.de>
p

diff --git a/p b/p
index 905091fdb0cc2bf8412ba30f17f305e4ebf8a426..eaab2d344caa46816f2296eac488dad0eb5c49ea 100755 (executable)
--- a/p
+++ b/p
@@ -564,7 +564,7 @@ case $cmd in
   review )
        # there are some patches in .removed that may be included in the current source
        # we try to backout each one. If it backs out successfully, we move it to
-       # .reviewed and conitnue, else  we abort
+       # .reviewed and continue, else  we abort
        # Once this has been done often enough, 'reviewed' should be run to
        # move stuff to 'included' and to revert those patches
        force=
@@ -572,10 +572,21 @@ case $cmd in
            force=yes; shift
        fi
        make_diff; get_meta
-       if [ -s .patches/path ]
+       if [ -s .patches/patch ]
         then
            echo >&2 Patch $name already open, please deal with it; exit 1;
        fi
+       if [ -f .patches/in-review ]
+       then :
+       else
+               applied=`ls .patches/applied`
+               if [ -n "$applied" ]
+               then
+                       echo >&2 Cannot review patches while any are applied.
+                       exit 1;
+               fi
+               > .patches/in-review
+       fi
        if [ $# -eq 0 ]
        then
            echo "Pending patches are:"
@@ -644,6 +655,11 @@ case $cmd in
              # all the currently applied patches are patches that have been
              # reviewed as included.
              # rip them out and stick them (reversed) into included.
+             if [ ! -f .patches/in-review ]
+                 then
+                     echo >&2 Not currently reviewing patches!
+                     exit 1;
+             fi
              while p open last
              do
                make_diff -R
@@ -653,6 +669,7 @@ case $cmd in
                all_files discard_one
                rm -f .patches/name .patches/status .patches/notes
              done
+             rm .patches/in-review
              ;;
   list )
            echo "Applied patches are:"
@@ -663,6 +680,11 @@ case $cmd in
            exit 0
            ;;
  apply )
+       if [ -f .patches/in-review ]
+       then
+               echo >&2 Cannot apply patches while reviewing other - use p reviewed
+               exit 1
+       fi
        force= append=
        if [ " $1" = " -f" ]; then
            force=yes; shift